#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
//https://leetcode.cn/problems/invert-binary-tree/submissions/
void Swap(struct TreeNode* left, struct TreeNode* right, struct TreeNode* parent)
{
    if (parent == NULL)
        return;

    struct TreeNode* tmp = left;
    parent->left = right;
    parent->right = tmp;
}
struct TreeNode* invertTree(struct TreeNode* root) {
    if (root == NULL)
        return NULL;


    Swap(invertTree(root->left), invertTree(root->right), root);

    return root;
}